package com.mqtt.demo1.config;

import com.mqtt.demo1.service.MqttService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author renyitong
 * @version 1.0.0
 * @createTime 2023年08月31日
 * @Description
 */
@Slf4j
@Component
public class MqttLineRunner implements CommandLineRunner {

    @Autowired
    private MqttService mqttService;

    @Autowired
    private com.mqtt.demo1.listener.MessageListener MessageListener;

    @Override
    public void run(String... args) throws Exception {
        mqttService.subscribe("youlemei", MessageListener);
    }
}
